package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A Ware.
 *  ware 积分商品
 *  name 名字
 *  detail 详情
 *  score 所需积分
 *  createdAt 创建时间
 *  modifiedAt 修改时间
 *  quantum 数量
 *  upper 上限
 *  surplus 剩余
 *  userId 用户ID
 *  leaguerId 会员ID
 *  photograph 图片地址
 *  
 */
@Entity
@Table(name = "ware")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Ware implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "detail")
    private String detail;

    @Column(name = "score")
    private Integer score;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "modified_at")
    private ZonedDateTime modifiedAt;

    @Column(name = "quantum")
    private Integer quantum;

    @Column(name = "upper")
    private Integer upper;

    @Column(name = "surplus")
    private Integer surplus;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "leaguer_id")
    private Long leaguerId;

    @Column(name = "photograph")
    private String photograph;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public Ware name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDetail() {
        return detail;
    }

    public Ware detail(String detail) {
        this.detail = detail;
        return this;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Integer getScore() {
        return score;
    }

    public Ware score(Integer score) {
        this.score = score;
        return this;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public Ware createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public ZonedDateTime getModifiedAt() {
        return modifiedAt;
    }

    public Ware modifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
        return this;
    }

    public void setModifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
    }

    public Integer getQuantum() {
        return quantum;
    }

    public Ware quantum(Integer quantum) {
        this.quantum = quantum;
        return this;
    }

    public void setQuantum(Integer quantum) {
        this.quantum = quantum;
    }

    public Integer getUpper() {
        return upper;
    }

    public Ware upper(Integer upper) {
        this.upper = upper;
        return this;
    }

    public void setUpper(Integer upper) {
        this.upper = upper;
    }

    public Integer getSurplus() {
        return surplus;
    }

    public Ware surplus(Integer surplus) {
        this.surplus = surplus;
        return this;
    }

    public void setSurplus(Integer surplus) {
        this.surplus = surplus;
    }

    public Long getUserId() {
        return userId;
    }

    public Ware userId(Long userId) {
        this.userId = userId;
        return this;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getLeaguerId() {
        return leaguerId;
    }

    public Ware leaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
        return this;
    }

    public void setLeaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
    }

    public String getPhotograph() {
        return photograph;
    }

    public Ware photograph(String photograph) {
        this.photograph = photograph;
        return this;
    }

    public void setPhotograph(String photograph) {
        this.photograph = photograph;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Ware ware = (Ware) o;
        if (ware.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, ware.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Ware{" +
            "id=" + id +
            ", name='" + name + "'" +
            ", detail='" + detail + "'" +
            ", score='" + score + "'" +
            ", createdAt='" + createdAt + "'" +
            ", modifiedAt='" + modifiedAt + "'" +
            ", quantum='" + quantum + "'" +
            ", upper='" + upper + "'" +
            ", surplus='" + surplus + "'" +
            ", userId='" + userId + "'" +
            ", leaguerId='" + leaguerId + "'" +
            ", photograph='" + photograph + "'" +
            '}';
    }
}
